using UnityEngine;

public class EntityTriggers
{
	public IWeaponCartridgeEntity entity;

	public Collider2D[] colliders;

	public EntityTriggers(IWeaponCartridgeEntity entity)
	{
		this.entity = entity;
		UpdateTriggers();
	}

	public void SetActiveTriggers(bool value)
	{
		for (int i = 0; i < colliders.Length; i++)
		{
			if (colliders[i] != null && colliders[i].isTrigger && colliders[i].sharedMaterial != null)
			{
				colliders[i].enabled = value;
			}
		}
		entity.OnSwitchTriggers(value);
	}

	public void UpdateTriggers()
	{
		colliders = entity.gameObject.GetComponentsInChildren<Collider2D>(includeInactive: true);
	}
}
